/* 
 * File:   user_config.h
 * Author: Administrator
 *
 * Created on 2015年5月19日, 下午1:32
 */

#ifndef USER_CONFIG_H
#define	USER_CONFIG_H

#ifdef	__cplusplus
extern "C" {
#endif

#define	MES_OFS_ALARM_1		0X0000
#define	MES_OFS_ALARM_2		0X0001
#define	MES_OFS_ALARM_3		0X0002
#define	MES_OFS_ALARM_4		0X0003

#define	MES_OFS_DRV_STATE	0X0006
#define	MES_OFS_WELL_STATE	0X0007
#define	MES_OFS_DI_STATE	0X0009
#define	MES_OFS_DO_STATE	0X000A
#define MES_OFS_AI_STATE        0X000B

#define MES_0FS_AI1_I           0X000F
#define MES_OFS_AI2_I           0X0010

#define	MES_OFS_AI1_VALUE	0X0012
#define	MES_OFS_AI2_VALUE	0X0013

#define	MES_OFS_DEV_TIME	0X0016

#define	CFG_OFS_DEV_CODE	0X0000
#define	CFG_OFS_FAC_CODE	0X0001
#define	CFG_OFS_FAC_DATE	0X0002

#define	CFG_OFS_DEV_TYPE	0X0005

#define	CFG_OFS_DEV_SN		0X0009

#define	CFG_OFS_DEV_ADDR	0X000C

#define	CFG_OFS_SOFT_V		0X000D

#define	CFG_OFS_ALARM1_EN	0X000E
#define	CFG_OFS_ALARM2_EN	0X000F
#define	CFG_OFS_ALARM3_EN	0X0010
#define	CFG_OFS_ALARM4_EN	0X0011

#define	CFG_OFS_CAN_DEBUG_LEVEL	0X0012

#define	CFG_OFS_DI_CHECK_NUM	0X0013 //DI点判断次数。 
#define	CFG_OFS_DI_CHECK_TMR	0X0014 //DI点判断间隔（单位毫秒）。 

#define CFG_OFS_CTL_TYPE        0X0015
#define	CFG_OFS_AI1_HI_VALUE	0X0016
#define	CFG_OFS_AI1_LO_VALUE	0X0017
#define	CFG_OFS_AI1_POINT_BIT	0X0018
#define CFG_OFS_AI1_HI_ALARM    0X0019
#define CFG_OFS_AI1_HI_TIME     0X001A
#define CFG_OFS_AI1_LO_ALARM    0X001B
#define CFG_OFS_AI1_LO_TIME     0X001C


#define	CFG_OFS_AI2_HI_VALUE	0X001D
#define	CFG_OFS_AI2_LO_VALUE	0X001E
#define	CFG_OFS_AI2_POINT_BIT	0X001F
#define CFG_OFS_AI2_HI_ALARM    0X0020
#define CFG_OFS_AI2_HI_TIME     0X0021
#define CFG_OFS_AI2_LO_ALARM    0X0022
#define CFG_OFS_AI2_LO_TIME     0X0023

#define	CFG_OFS_DO1_KEEP	0X0025
#define	CFG_OFS_DO2_KEEP	0X0026

#define	CFG_OFS_CAN_BAUD_RATE	0X0027
#define	CFG_OFS_FRE_RATE	0X0028
#define	CFG_OFS_AO_CHANNEL	0X0029

#define	CFG_OFS_AO_SPEED_UP	0X002A
#define	CFG_OFS_AO_SHOW_DOWN	0X002B

#define MES_TBL_SIZE 64
#define CFG_TBL_SIZE 64


#define		CFG_TBL_START_ADDR		0x0000 		//配置信息表起始地址
#define		CFG_TBL_END_ADDR		0x0013 		//配置信息表结束地址

#define		MES_TBL_START_ADDR		0x1000 		//测量信息表起始地址
#define		MES_TBL_END_ADDR		0x103F 		//测量信息表结束地址

uint16_t mes_tbl[MES_TBL_SIZE];
uint16_t cfg_tbl[CFG_TBL_SIZE];
uint16_t cfg_tbl_temp[CFG_TBL_SIZE];
uint32_t dev_timer;


//以下是用于校准的信息。
#define		CAL_OFS_AOH_LO		0x00
#define		CAL_OFS_AOH_HI		0x01
#define		CAL_OFS_AOB_LO		0x02
#define		CAL_OFS_AOB_HI		0x03

#define		CAL_OFS_AI1_LO		0x04
#define		CAL_OFS_AI1_HI		0x05

#define		CAL_OFS_VOH_LO		0x06
#define		CAL_OFS_VOH_HI		0x07
#define		CAL_OFS_VOB_LO		0x08
#define		CAL_OFS_VOB_HI		0x09

//#define		CAL_OFS_AI2_LO		0x06
//#define		CAL_OFS_AI2_HI		0x07


#define SOFT_VERSION    20002


uint16_t cal_para[16]; //存储校准参数使用。 

#ifdef	__cplusplus
}
#endif

#endif	/* USER_CONFIG_H */

